home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / SHELLS / SZ2 / INPUT1.EVT < prev    next >
Text File  |  1992-08-31  |  3KB  |  91 lines

  1.    {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  2.  
  3.    DATA TRANSFER - note that we do NOT have to pay attention to the
  4.    dialog's record structure; "Get/Set DataRec" (from the GENERAL
  5.    unit) will access only sub-views which accept or return data.
  6.  
  7.    This lets us use plain, vanilla "string" type, so we can use the
  8.    dialog's TInputLine to change the acceptable length of the field.
  9.  
  10.    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  11.    {===================================================================
  12.  
  13.    DIALOG --> BUFFER (read each TInputLine field)
  14.  
  15.    ===================================================================}
  16. procedure GetAllFields ( D : PDialog ) ;
  17. var
  18.    x                         : byte ;
  19. begin
  20.    for x := 1 to FldCnt do
  21.       GetDataRec ( D ,
  22.                    x ,
  23.                    @DataArray[CurRec][x] ) ;
  24. end ;
  25.    {===================================================================
  26.  
  27.    BUFFER --> DIALOG (writes each TInputLine field)
  28.  
  29.    ===================================================================}
  30. procedure SetAllFields ( D : PDialog ) ;
  31. var
  32.    x                         : byte ;
  33. begin
  34.    for x := 1 to FldCnt do
  35.       SetDataRec ( D ,
  36.                    x ,
  37.                    @DataArray[CurRec][x] ) ;
  38.    SetDataRec ( D , FldCnt + 1 , @CurRec ) ;
  39. end ;
  40.    {|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  41.  
  42.    EVENTS
  43.  
  44.    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  45.    {-------------------------------------------------------------------
  46.    PREV
  47.    -------------------------------------------------------------------}
  48. procedure hdPrevRecord ;
  49. begin
  50.    if CurRec = 1 then
  51.    begin
  52.       buzz ;
  53.       EXIT ;
  54.    end ;
  55.    GetAllFields ( MyDialog ) ;
  56.    dec ( CurRec ) ;
  57.    SetAllFields ( MyDialog ) ;
  58. end ;
  59.    {-------------------------------------------------------------------
  60.    NEXT
  61.    -------------------------------------------------------------------}
  62. procedure hdNextRecord ;
  63. begin
  64.    if CurRec = MaxRecs then
  65.    begin
  66.       buzz ;
  67.       EXIT ;
  68.    end ;
  69.    GetAllFields ( MyDialog ) ;
  70.    inc ( CurRec ) ;
  71.    SetAllFields ( MyDialog ) ;
  72. end ;
  73.    {-------------------------------------------------------------------
  74.    FIRST
  75.    -------------------------------------------------------------------}
  76. procedure hdFirst ;
  77. begin
  78.    GetAllFields ( MyDialog ) ;
  79.    CurRec                    := 1 ;
  80.    SetAllFields ( MyDialog ) ;
  81. end ;
  82.    {-------------------------------------------------------------------
  83.    LAST
  84.    -------------------------------------------------------------------}
  85. procedure hdLast ;
  86. begin
  87.    GetAllFields ( MyDialog ) ;
  88.    CurRec                    := MaxRecs ;
  89.    SetAllFields ( MyDialog ) ;
  90. end ;
  91.